package com.lingyu.controller;

import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.lingyu.biz.ICommentBiz;
import com.lingyu.pojo.Comment;

@Controller
@RequestMapping("comment")
public class CommentController {
	
	@Resource
	private ICommentBiz commentBiz;

	@RequestMapping("addcomment")
	public String addComment(Comment comment){
		if(comment.getFather()!=null && comment.getFather().getCommentId().trim().length()==0){
			comment.getFather().setCommentId(null);
		}
		comment.setTime(new Date());
		commentBiz.addComment(comment);
		
		return "/topic/getalltopics.do";
	}
}
